package com.briup.srms.exam.web.controller;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.srms.exam.bean.ExamAnswer;
import com.briup.srms.exam.bean.extend.ExamAnswerExtend;
import com.briup.srms.exam.service.IAnswerService;
import com.jacky.base.utils.Message;
import com.jacky.base.utils.MessageUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @program: 杰普基础管理系统
 * @description: 答卷控制器类
 * @author: charles
 * @create: 2021-3-25 11:09
 **/
@Api(description="答卷相关接口")
@Validated
@RestController
@RequestMapping("/exam/answer")
public class AnswerController {
	
	@Autowired
	private IAnswerService answerService;
	
	@ApiOperation(value = "阅卷老师阅卷")
	@GetMapping("queryByStudentExamId")
	public Message queryByStudentExamId(long studentExamId) {
		List<ExamAnswer> list = answerService.queryByStudentExamId(studentExamId);
		return MessageUtil.success(list);
	}
	
	@ApiOperation(value = "阅卷老师阅卷")
	@PostMapping("inspectionPaper")
	public Message inspectionPaper(@RequestBody List<ExamAnswer> answers){
		answerService.inspectionPaper(answers);
		return MessageUtil.success("评阅成功");
	}
	
	@ApiOperation(value = "提交试卷")
	@PostMapping("submitPaperAnswer")
	public Message submitPaperAnswer(@RequestBody List<ExamAnswerExtend> list) {
		answerService.submitPaperAnswer(list);
		return MessageUtil.success("提交成功");
	}
}
